# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=gstreamer-vaapi
pkgver=1.18.5
pkgrel=1
pkgdesc="Multimedia graph framework - vaapi plugin"
url="https://gstreamer.freedesktop.org/"
arch=(x86_64)
license=(LGPL)
depends=(gst-plugins-bad libva libxrandr)
makedepends=(python git meson gtk3)
_commit=edc4d3514ba7ef17f2a8877b5a21645f380932f5  # tags/1.18.5^0
source=("git+https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname
}

build() {
  arch-meson $pkgbase build \
    -D doc=disabled \
    -D package-origin="https://www.archlinux.org/"
  meson compile -C build
}

check() (
  mkdir -p -m 700 "${XDG_RUNTIME_DIR:=$PWD/runtime-dir}"
  export XDG_RUNTIME_DIR

  # Fails without hardware
  meson test -C build --print-errorlogs || :
)

package() {
  meson install -C build --destdir "$pkgdir"
}
